package cli
import (
	"github.com/micro/go-micro/cmd"
	order "git.oschina.net/fanbuchi/xgggh/order/proto/order"
	"github.com/micro/go-micro/client"
	"golang.org/x/net/context"
)
// Query 对外提供订单查询服务
// 是否需要鉴权  是
func Query(params *order.QueryReq)(*order.QueryRsp,error) {
	cmd.Init()
	_client:=client.DefaultClient
	cl := order.NewOrdersClient("com.xgggh.srv.order", _client)
	ctx:=context.Background()
	rsp, err := cl.Query(ctx, params)
	if err != nil {
		return nil,err
	}
	return rsp,nil
}

//订单状态更新
func Update(params *order.UpdateReq)(*order.Response,error) {
	cmd.Init()
	_client:=client.DefaultClient
	cl := order.NewOrdersClient("com.xgggh.srv.order", _client)
	ctx:=context.Background()
	rsp, err := cl.Update(ctx, params)
	if err != nil {
		return nil,err
	}
	return rsp,nil
}
